<template>
  <div class="modal-header">
    <div class="modal-title">
      <span v-if="pageDataList"
        >{{ l('操作记录 详情-') }}{{ pageDataList.entityTypeFullName }}</span
      >
    </div>
  </div>
  <slot></slot>
  <div class="modal-body">
    <p
      >由<b>{{ pageDataList?.userName }}</b
      >创建于{{ _moment(pageDataList?.changeTime) }}</p
    >
    <g-dynamic-table
      type="dataAuditLogsDetail"
      ref="table"
      :fetch="fetchDataList"
      :isPage="false"
    ></g-dynamic-table>
  </div>
  <div class="modal-footer">
    <a-button @click="close()" :type="'primary'">
      <close-circle-outlined />
      {{ l('Close') }}
    </a-button>
  </div>
</template>
<script lang="ts">
  import { ModalComponentBase } from '/@/shared/component-base';
  import { defineComponent } from 'vue';
  import {
    EntityChangeHistoryServiceProxy,
    EntityChangeListDto,
    EntityPropertyChangeDto,
  } from '/@/shared/service-proxies/service-proxies';
  import GDynamicTable from '/@/shared/components/g-dynamic-table/index.vue';

  export default defineComponent({
    name: 'data-audit-logs-detail',
    components: {},
    mixins: [ModalComponentBase],
    props: {
      pageDataList: EntityChangeListDto,
      GDynamicTable,
    },
    data() {
      return {
        entityChangeHistory: new EntityChangeHistoryServiceProxy(),
        entityPropertyItem: new Array<EntityPropertyChangeDto>(),
      };
    },
    mounted() {
      console.log(this.pageDataList);
    },
    methods: {
      /**查询数据 */
      fetchDataList() {
        return new Promise((resolve, reject) => {
          this.entityChangeHistory
            .getEntityPropertyChanges(this.pageDataList.id)
            .finally(() => {})
            .then((res) => {
              resolve(res);
            })
            .catch((error) => {
              reject(error);
            });
        });
      },
    },
  });
</script>
<style scoped lang="less">
  .modal-header,
  .modal-footer {
    margin: 0;
  }
  .modal-body {
    padding: 0;
    max-height: inherit;
    overflow: hidden;
  }
  .dynamic-table {
    padding: 0;
  }
  p {
    padding-left: 22px;
  }
</style>
